<template>
	<view class="cu-image-item border-radius-sm">
		<image :src="src" mode="aspectFill" class="cu-image"></image>
		<uni-icons type="clear" size="20" class="delete-icon" color="#FA5F5F" @click="handleDel"></uni-icons>
	</view>
</template>

<script>
	export default {
		name: "CuImageItem",
		props: {
			src: {
				type: String,
				default: ''
			},
			uuid: {
				type: [String, Number],
				default: ''
			}
		},
		methods: {
			// 删除图片
			handleDel() {
				this.$emit('delete', this.uuid)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.cu-image-item {
		width: 160rpx;
		height: 160rpx;
		border: 1rpx solid $uni-border-color;
		position: relative;
		box-sizing: border-box;
		padding: 4rpx;
		display: inline-flex;
		justify-content: center;
		align-items: center;
		.cu-image {
			width: 98%;
			height: 98%;
		}
		.delete-icon {
			position: absolute;
			right: 0;
			top: 0;
		}
	}
</style>